<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS 三角</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        .box {
            position: relative;
            width: 150px;
            height: 200px;
            margin: 30px auto;
            background-color: orange;
        }

        .s1 {
            position: absolute;
            top: -20px;
            right: 15px;
            width: 0;
            height: 0;
            /* 照顾兼容性 */
            line-height: 0;
            font-size: 0;
            border: 10px solid transparent;
            border-bottom-color: orange;
        }

        .price {
            width: 160px;
            height: 24px;
            line-height: 24px;
            border: 1px solid red;
            margin: 50px auto;
        }

        .miaosha {
            position: relative;
            /* 浮动才可以设置宽高 否则需要设置display行内块元素 */
            float: left;
            width: 90px;
            height: 100%;
            margin-right: 10px;
            text-align: center;
            background-color: red;
            color: #fff;
            font-size: 16px;
            font-weight: 700;
        }

        .miaosha i {
            position: absolute;
            right: 0;
            top: 0;
            width: 0;
            height: 0;
            border-color: transparent white transparent transparent;
            border-style: solid;
            border-width: 24px 10px 0 0;
        }

        .yuanjia {
            /* 浮动可以直接使得原价元素直接在右边显示，所以此处用浮动 */
            font-size: 12px;
            color: gray;
            text-decoration: line-through;
        }
    </style>
</head>

<body>
    <div class="price">
        <span class="miaosha">
            ￥1600
            <i></i>
        </span>
        <span class="yuanjia">￥9999</span>
    </div>

    <div class="box">
        <span class="s1"></span>
    </div>
</body>

</html>